#Requires AutoHotkey v2.0

; 加载简中字词表
#Include "./words/chs.ahk"
#Include "./utils.ahk"

#HotIf WinActive(windowName)
Space:: {
    res := FirstResult(windowName, mainButton, mainButtonExclude)

    if (res == 0) {
        Hotkey "Space", "Off"
        Send "{Space}"
        Hotkey "Space", "on"
        OutputDebug "未识别到关键字"
        return
    }
    OutputDebug "点击: " res.target.Text
    ClickPoint(res.target.x + res.target.w / 4, res.target.y - res.target.h)

    ; 高亮目标位置
    res.result.Highlight(res.target, -300)

}